package com.crm.crm.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import com.crm.crm.domain.role.SysRole;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

@Mapper
public interface UserRoleMapper extends BaseMapper<SysRole> {
    @Select("select * from sys_role")
    List<SysRole> selectAllRoles();

    @Insert("insert into sys_role_menu(role_id,menu_id) values(#{roleId},#{menuIds})")
    void saveRoleMenuIds(Long roleId, Long menuIds);

    @Delete("delete from sys_role_menu where role_id=#{roleId}")
    void deleteRoleMenuByRoleId(Long roleId);

    @Select("select menu_id from sys_role_menu where role_id=#{id}")
    List<Long> selectMenuIdsByRoleId(Long id);
}
